<meta title="添加红包" width="800px" args="redPacket"/>
<div class="p">
    <form s="valid,form,nda,datac"
          id="form" class="form-horizontal"
          method="post"
          s-data="redPacket"
          action="api/red-packet">
        <table class="table table-striped table-bordered">
            <tr>
                <td style="width: 100px" class="text-right">名称</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="name" placeholder="输入红包名称" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">描述</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="description" placeholder="输入红包描述" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">总数量</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="totalNum" placeholder="总数量" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">已领取数量</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="drawNum" placeholder="已领取数量" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">现金</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="money" placeholder="现金" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">积分</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="integral" placeholder="积分" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">开始时间</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="startTime" s="datetimepicker" placeholder="开始时间" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">结束时间</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="endTime" s="datetimepicker" placeholder="结束时间" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">频次类型</td>
                <td>
                    <select class="form-control input-sm" s="select"
                            name="freq"
                            s-build="S.get('/api/enum/valuesMap/core.enums.ActivityFreq')">
                    </select>
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">频次次数</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="maxUserGrantNum" placeholder="频次次数" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">有效天数</td>
                <td>
                    <input type="text" autocomplete="off" class="form-control" s-valid-error="require()" name="validDayNum" placeholder="有效天数" />
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">人群</td>
                <td>
                    <select class="form-control input-sm" s="select"
                            name="crowdId"
                            s-build="S.get('/api/crowd/list/VALID')">
                    </select>
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">现金明细类型</td>
                <td>
                    <select class="form-control input-sm" s="select"
                            name="moneyWalletFlowDetailType"
                            s-build="S.get('/api/enum/valuesMap/core.enums.WalletFlowDetailType')">
                    </select>
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">积分明细类型</td>
                <td>
                    <select class="form-control input-sm" s="select"
                            name="integralWalletFlowDetailType"
                            s-build="S.get('/api/enum/valuesMap/core.enums.WalletFlowDetailType')">
                    </select>
                </td>
            </tr>
            <tr>
                <td style="width: 100px" class="text-right">状态</td>
                <td>
                    <select class="form-control input-sm" s="select"
                            name="status"
                            s-build="S.get('/api/enum/valuesMap/core.enums.RedPacketStatus?igNames=DELETED')">
                    </select>
                </td>
            </tr>
        </table>
        <input autocomplete="off" type="hidden" name="typeConfig" id="config" />
    </form>
</div>
<style>
</style>
<script type="text/javascript">
    if(redPacket) {
        $form.node.attr("method", "put")
        $form.node.attr("action", "/api/red-packet/" + redPacket.id);
    }
    S.meta.btns = [
        {
            name: "保存",
            style: "btn btn-primary",
            click: function() {
                $form.validate().done(function(){
                    $form.submit().done(function() {
                        S.close(true)
                    })
                })
            }
        },
        {
            name: "关闭",
            style: "btn btn-default",
            click: function() {
                S.close();
            }
        }
    ]

</script>